<template>
  <div class="home">
    <HHeader v-if="showHeader"></HHeader>
    <Nav v-if="showNav"></Nav>
    <router-view></router-view>
  </div>
</template>

<script>
// @ is an alias to /src

import HHeader from '../components/HHeader'
import Nav from '../components/nav'
import contents from '../components/content'
export default {
  name: 'home',
  components: {
    HHeader,
    Nav,
    contents
  },
  computed:{
    showHeader(){
      return this.$store.state.showHeader;
    },
    showNav(){
      return this.$store.state.showNav;
    }
  },
  watch:{
    $route(newRoute){
      // 如果在推荐音乐盒内，隐藏头部和导航栏
      console.log(newRoute)
      if(false){

      }
      else{
        this.$store.commit("setshowHeader",{
          showHeader:true
        });
        this.$store.commit("setshowNav",{
          showNav:true
        });
      }
    }
  }
}
</script>
<style>
.home{
  background-color: #f8f8f8;
  min-height: 100%;
}
</style>
